<template>
	<div class="container">
		<div class="myBox">
			<div class="L">
				<van-image round width="80px" height="80px" :src="business.avatar_text" fit="cover" @click="preview" />
			</div>
			<div class="C">
				<div class="tit">{{ business.nickname }}</div>
				<div class="sub">{{ business.hide_mobile_text }}</div>
			</div>
		</div>

		<div class="space"></div>

		<van-cell title="基本资料" is-link to="/business/profile" />
		<van-cell title="邮箱认证" is-link to="/business/email" v-if="business.auth === '0'" />
		<van-cell title="我的收货地址" is-link to="/address" />
		<van-cell title="我的订单" is-link to="/order/index"/>
		<van-cell title="消费记录" is-link to="/business/record" />
		<van-cell title="我的钱包" is-link to="/business/wallet" />
		<van-cell title="退出登录" is-link @click="logout" />
	</div>
</template>

<script setup>
import { showImagePreview } from 'vant';
import { getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance();

const business = proxy.$cookies.get('business');
console.log(business);

function logout() {
	proxy
		.$confirm({
			title: '提示',
			message: '确定要退出登录吗？',
		})
		.then(() => {
			proxy.$cookies.remove('business');
			proxy.$router.push('/business/login');
		});
}

const preview = () => showImagePreview([business.avatar_text]);
</script>

<style scoped></style>
